package com.fight.strive.sys.modules.rbac.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fight.strive.sys.modules.common.BaseEntity;
import com.fight.strive.sys.modules.validator.StriveNotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * 部门表
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Entity
@Table(name = "t_sys_rbac_department",
        indexes = {
                @Index(columnList = "parentId"),
                @Index(columnList = "seq")})
@TableName("t_sys_rbac_department")
public class RbacDepartmentEntity extends BaseEntity {

    /**
     * 代码，或拼音全拼
     */
    @Column(unique = true)
    @StriveNotBlank(msg = "部门编号不能为空")
    private String code;

    /**
     * 部门名称
     */
    @StriveNotBlank(msg = "部门名称不能为空")
    private String name;

    /**
     * 父组织ID，顶级组织的 parentId 为 0
     */
    private Long parentId;

    /**
     * 排序序号
     */
    private Double seq;

}
